'''
Created on Oct 21, 2014
@author: azhelezny
'''
import sys

inputFile = open("D:\\fasta.input")
matrix = []
fileString=inputFile.readline()
while 1:
    if(not fileString):
        break
    rName = fileString.replace("\n","").replace(">","")
    temp = ""
    while 1:
        fileString = inputFile.readline().replace("\n","")
        if(not fileString or fileString.count(">") != 0):
            break
        temp+=fileString
    matrix.append(temp)
inputFile.close()

profileMatrix = []
adenine = []
cytosine = []
guanine = []
tymin = []

for i in range(0,len(matrix[0])):
    adenine.append(0)
    cytosine.append(0)
    guanine.append(0)
    tymin.append(0)
    for j in range(0, len(matrix)):
        if(matrix[j][i] == 'A'):
            adenine[i] += 1
        if(matrix[j][i] == 'C'):
            cytosine[i] += 1
        if(matrix[j][i] == 'G'):
            guanine[i] += 1
        if(matrix[j][i] == 'T'):
            tymin[i] += 1
profileMatrix.append(adenine)
profileMatrix.append(cytosine)
profileMatrix.append(guanine)
profileMatrix.append(tymin)

for i in range (0,len(profileMatrix[0])):
    maxIndex = 0
    maxValue = profileMatrix[0][i]
    for j in range(1,len(profileMatrix)):
        if(profileMatrix[j][i]>maxValue):
            maxValue = profileMatrix[j][i]
            maxIndex = j
    if(maxIndex == 0):
        sys.stdout.write("A")
    if(maxIndex == 1):
        sys.stdout.write("C")
    if(maxIndex == 2):
        sys.stdout.write("G")
    if(maxIndex == 3):
        sys.stdout.write("T")    

print("")
for i in range (0,4):
    if(i==0):
        sys.stdout.write("A: ")
    if(i==1):
        sys.stdout.write("C: ")
    if(i==2):
        sys.stdout.write("G: ")
    if(i==3):
        sys.stdout.write("T: ")
    for j in range (0,len(profileMatrix[i])):
        sys.stdout.write(format(profileMatrix[i][j])+" ")
    print("")
